package com.itheima.Object.test2;

public class Demo {
    public static void main(String[] args) {
        Student s = new Student("张三",23);
        System.out.println(s); //打印的是地址值com.itheima.Object.test2.Student@50cbc42f
        //System.out.println(s.toString());
    }
}
//创建一个学生类

class Student{
    private String name;
    private int age;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}